	<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
	
<jsp:useBean id="oLogon" class="git.bankview.wl.bean.LogonBean" scope="session" />

<link rel="stylesheet" type="text/css"
	href="<%=request.getContextPath()%>/ext/core/ext/resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css"
	href="<%=request.getContextPath()%>/ext/core/extra/css/button.css" />
<link rel="stylesheet" type="text/css"
	href="<%=request.getContextPath()%>/ext/core/extra/css/common.css" />
	
<script type="text/javascript">
	function updateExpandFlag(flag){
		var requestURI= '<%=request.getRequestURI()%>';
		var contextPath= '<%=request.getContextPath()%>';
		//只在当前页面执行此动作
		if(requestURI == contextPath+'/main.jsp'){
			Ext.Ajax.request({
			    url :'/bidevapp/center.do?action=updateExpandFlag&expandFlag='+flag+'&userId=<%=oLogon.getUsername()%>',
			    success : function(response) {
					//alert("保存成功！");
			    },
			    failure : function(response) {
					//alert("保存失败");
			    }
			  });
		}
	}
</script>

<script type="text/javascript"
	src="<%=request.getContextPath()%>/ext/core/ext/adapter/ext/ext-base.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/ext/core/ext/ext-all.js"></script>

<script type="text/javascript">
           
Ext.onReady(function(){
Ext.BLANK_IMAGE_URL = "<%=request.getContextPath()%>/ext/core/ext/resources/images/default/s.gif";


var viewPort = new Ext.Viewport({
    layout: 'border',
    defaults: {
        activeItem: 0
    },

    items: [ {
        region: 'west',
        collapsible: true,
        title: '<font size="2">索引</font>',
        xtype: 'treepanel',
        width: 200,
        autoScroll: true,
        split: true,
        loader: new Ext.tree.TreeLoader({
     dataUrl:'cognos/loadTreeAction.do?action=loadTree',
     listeners:{
         "beforeload":function(treeLoader,node) {
             treeLoader.baseParams.id=(node.id!="root"?node.id:"");
         },
         "load":function(treeLoader,node){
             //在树节点加载后执行的动作
        	 fireClick();
         }
        }

    }),
        root: new Ext.tree.AsyncTreeNode({
           text:'test',
           draggable:false,
           id:'root'
           },
            {
                text:'test',
                html:'test.jsp',
                leaf: true
            }
            , 
            {
                text:'top',
                html:'top.jsp',
                leaf: true
            }
            ,
            {
                text:'center',
                html:'center.jsp',
                leaf: true
            }
            , 
            
            {
                text:'configOpinion',
                html:'jsp/common/configOpinion.jsp',
                leaf: true
            } 
          
       		
        ),
        
        rootVisible: false,
        listeners: {
        	/*
        	click: function(treeLoader,node){
							node.target.fireEvent("ondblclick");
        	 		//fireClick();
              
        	}*/
        	
            click: function(n,node) {
            
        		document.getElementById("uname").value=n.text;
        		
        			if(n.attributes.leaf == undefined){
        				node.target.fireEvent("ondblclick");
            		//Ext.get('templetFrame').dom.src= "<%=request.getContextPath()%>/center.jsp";
            		//change
            		/*
            		Ext.get('templetFrame').dom.src= "<%=request.getContextPath()%>/center.do?action=centerload&userid="+oLogonvalue;
            		document.getElementById("upath").value=Ext.get('templetFrame').dom.src;
            		document.getElementById("userid").value=oLogonvalue;
            		*/
	            	}else {
	            		var urlStr = n.attributes.url ;
		            	var str = urlStr.substring(0,4);
	            		if( str == "http" ){
	           				Ext.get('templetFrame').dom.src = encodeURI(n.attributes.url);
	           				//add
	           				document.getElementById("upath").value=Ext.get('templetFrame').dom.src;
	           				document.getElementById("userid").value=oLogonvalue;
	           				
	           			} else {
	           				Ext.get('templetFrame').dom.src ="<%=request.getContextPath()%>"+"/"+n.attributes.url;
	           				//add
	           				
	           				document.getElementById("upath").value=Ext.get('templetFrame').dom.src;
	           				document.getElementById("userid").value=oLogonvalue;
	           				
	           			}
	           		}
        		
            	
           		
           		
            } 
        }
    }, 
    {
        region: 'north',
	    autoHeight: false,
	    height:57,
	    html:'<iframe width=100% src="top.jsp"/>'
    },
    {
    	id:'centerpanel',
        region: 'center',
        xtype: 'panel',
    //    title:'<font size="2">主页名称</font>',
        collapsible:false,
        frame: false,
        html:'<iframe width="100%" height="100%" id="templetFrame" src="<%=request.getContextPath()%>/center.do?action=centerload&userid=<%=oLogon.getUsername()%>" SCROLLING="yes"/>'
    }]
});

})
</script>


<!-- <iframe id="iframe1" name="iframe1" style="display: none;"></iframe> -->
<!-- <form id="form1" name="form1" action="<%=request.getContextPath()%>/cognos/loadUrllistAction.do" method="post" target="iframe1"> -->
<form id="form1" name="form1">
	<input type=hidden id="uname" name="pageName" value="" />
	<input type=hidden id="upath" name="pagePath" value="" />
	<input type=hidden id="userid" name="userId" value="" />
	<input type=hidden name="action"  value="insertData"/>
</form>

<script>
oLogonvalue="<%=oLogon.getUsername()%>";
function fireClick(){
	//取出div
	var collapsedDiv = document.getElementById("ext-gen11");
	if(collapsedDiv == null){
		while(collapsedDiv == null){
			collapsedDiv = document.getElementById("ext-gen11");
			if(collapsedDiv != null)
				break;
		}
	}

	var expandFlag = <%=request.getAttribute("expandedFlag")%>;
	//给div发送click事件
	if(!expandFlag){
		if(navigator.userAgent.indexOf("MSIE")>0){
			collapsedDiv.fireEvent("onclick");
	    }else{
	    	var e=document.createEvent('MouseEvent');   
	        e.initEvent('click',false,false);
	        collapsedDiv.dispatchEvent(e);
	    }
	}
}
</script>



